<?php
    if(!$this->session->userdata('logged_in')) {
        redirect('logout');
    } else if($this->session->userdata('role') === 'viewer') {
        redirect('forbidden');
    }
?>
<div id="post_container">
    <div id="post_pending_wrapper">
        <div class="wrapper">
          <?php
            if($this->session->userdata('role') === "admin"){
                $this->table->set_heading('Title','Author',"","");
            }else{
                $this->table->set_heading('Title');
            }
            $tmpl = array('table_open' => '<table id="big_table" class="display" width="100%" align="center"> ');
            $this->table->set_template($tmpl);
            echo $this->table->generate($tabl);
          ?>
       </div>
       
       <script type="text/javascript">
 $(document).ready(function() {
          var oTable = $('#big_table').dataTable( {
                'iCookieDuration': 60,
                'bStateSave'     : true,
                'bServerSide'    : false,
                'bAutoWidth'     : true,
                'bProcessing': true,
                'sDom': 'T<"clear">lfrtip',
                'oTableTools': {
                  "aButtons": [
                      {
                          "sExtends": "copy",
                          "mColumns": [1, 2, 3, 4, 5, 6, 7, 8]
                      },
                      {
                          "sExtends": "csv",
                          "mColumns": [1, 2, 3, 4, 5, 6, 7, 8]
                      },
                      {
                          "sExtends": "xls",
                          "mColumns": [1, 2, 3, 4, 5, 6, 7, 8]
                      },
                      {
                          "sExtends": "pdf",
                          "mColumns": [1, 2, 3, 4, 5, 6, 7, 8]
                      }
                  ],
                  "sSwfPath" : "resources/swf/copy_csv_xls_pdf.swf"
                },
                "bJQueryUI": true,
                "sPaginationType": "full_numbers",
                "iDisplayStart ":20,
                "oLanguage": {
                    "sProcessing": "<img src='resources/images/ajax-loader_dark.gif'>",
                    "sSearch": "Search:"
                  }, 
                  "fnInitComplete": function() {
                    oTable.fnAdjustColumnSizing();
                  }
          } );
          oTable.fnSort( [ [2,'desc'] ] );
     } );
    </script>
    </div>
    <div class="balancer"></div>
</div>
